package com.tbit.uqbike.object.pojo.dto;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.util.Objects;

/**
 * @author yee_
 * @version 1.0
 * @date 2023/2/15 10:31
 */
@Getter
@Setter
@Accessors(chain = true)
@ToString
public class UserRidingScoreModifyDTO {
    /**
     * 用户id
     */
    @NotNull(message = "请填写用户id")
    private Integer userId;
    /**
     * 修改类型
     */
    @NotNull(message = "请选择修改类型:加分或减分")
    private Boolean isAdd;
    /**
     * 变动分值
     */
    @NotNull(message = "请填写变动分值")
    @Min(value = 1, message = "变动分值最小为1")
    @Max(value = 600, message = "变动分值最大为600")
    private Integer modifyScore;
    /**
     * 操作密钥
     */
    private String psw;
    /**
     * 备注
     */
    @NotNull(message = "请填写备注")
    private String remark;


    private Integer operationId;
    private String operationPhone;

    public boolean pswValid(String correctKey) {
        return !Objects.equals(this.psw, correctKey);
    }

}
